
grid=$1
tof=$2

echo
echo ++++++++++++++++++++++++++  only for FF! +++++++++++++++++++++++++++++++++
echo grid $grid
echo tof $tof
echo

dd0=$(pwd)

#GSI
absd=/hera/alice/xlu/workspace/hera2dbetabloch/FracFunc_10-d-e

#HD
#absd=/alidata60/alice_u/lu/workspace/hera2dbetabloch/FracFunc_10-d-e

for pp in $(echo $tof/DATA*  | sed s/ETA[0-9]/ETAX/g |tr -s ' ' '\n'|  sort -u)
do
    tag=$(echo $pp  | tr -s '/' '_' )_$tof
    
    echo $tag
    dir=cmpEta_$tof\_GrID$grid/$tag
        
    mkdir -p $dir
    touch $(dirname $dir)

    cd $dir

    for jj in $(seq 0 3)
    do 
        if [ -L ETA$jj\_$tag.root ]
        then
            unlink ETA$jj\_$tag.root
        fi

        file=$(echo $(echo $dd0/$pp | sed s/ETAX/ETA$jj/g)/Sys$grid/out*.root)
        echo $file
        ln -s $file ETA$jj\_$tag.root
            
    done
    
        #if [ ! -L ../drawFractionRatio.C ]; then ln -s /u/xlu/.task/2dbetabloch/plotcode/drawFractionRatio.C ../; fi
        #if [ ! -L ../style.h ]; then ln -s $myAliROOT/XGLUtils/style.h ../; fi
        #if [ ! -L ../AnaDef.h ]; then ln -s $myINC/AnaDef.h ../; fi
    
    rm -f drawFractionRatio

    cp $absd/../drawFractionRatio .
    
    cp $absd/DATAdodrawcmpEta.sh do.sh
    cd $dd0
done
